import { ipcMain } from 'electron'
import {
  getServerConfig,
  getServerIP,
  updateServerConfig
} from '../dao/ipAddresses.js'

export function init() {
  // 获取服务器配置
  ipcMain.handle('serverConfig/get', () => {
    return getServerConfig()
  })

  // 获取服务器IP
  ipcMain.handle('serverConfig/getIP', () => {
    return getServerIP()
  })

  // 更新服务器配置
  ipcMain.handle('serverConfig/update', (event,...args) => {
    return updateServerConfig(...args)
  })
}
